package dao;

import java.sql.ResultSet;
import java.sql.SQLException;

import net.sf.json.JSONObject;
import util.database.DBHelper;

public class GetArticleDao {

	public static JSONObject GetArticle(int artId) throws ClassNotFoundException, SQLException {
		String sql = "select id,title,contents,url from document where id='" + artId + "'";
		ResultSet rSet = DBHelper.executeQuery(sql);
		JSONObject jobj = new JSONObject();
		while (rSet.next()) {

			jobj.put("id", rSet.getInt("id"));
			jobj.put("title", rSet.getString("title"));
			jobj.put("contents", rSet.getString("contents"));
			jobj.put("url", rSet.getString("url"));

		}
		return jobj;
	}
}
